package com.local.web.service.impl;

import com.local.common.constants.BusinessException;
import com.local.common.util.ResultUtil;
import com.local.indexconfig.feign.IndexConfigServiceFeign;
import com.local.indexconfig.pojo.IndexConfig;
import com.local.web.service.IndexConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IndexConfigServiceImpl implements IndexConfigService {

    @Autowired
    private IndexConfigServiceFeign indexConfigServiceFeign;

    @Override
    public  List<IndexConfig> getListByConfigType(Integer configType, Integer number) {
        ResultUtil<List<IndexConfig>> result = indexConfigServiceFeign.getListByConfigType(configType, number);
        if (result.getCode() != 200) {
            throw new BusinessException(result.getCode(), result.getMessage());
        }
        List<IndexConfig> data = result.getData();
        return data;
    }
}
